/**
 * Created on 2007-05-19 02:22
 */
package game.frames;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextArea;

/**
 * @author David Wallin
 */
public class CreditsFrame extends BasicFrame
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6637578727227741145L;
	private JLabel					m_Header;
	private JTextArea				m_Credits;
	private JButton					m_Main;
	
	/**
	 * 
	 */
	public CreditsFrame()
	{
		super(new GridBagLayout());
	}
	
	/* (non-Javadoc)
	 * @see frames.BasicFrame#initializeComponent()
	 */
	@Override
	protected void initializeComponent()
	{
		this.setBackground(Color.black);
		GridBagLayout gridBag = (GridBagLayout)this.getLayout();
		
		GridBagConstraints headerConstraints = new GridBagConstraints();
		headerConstraints.insets = new Insets(10, 0, 0, 0);
		headerConstraints.gridx = 1;
		headerConstraints.gridy = 0;
		headerConstraints.gridwidth = 1;
		headerConstraints.weightx = 0.5;
		
		GridBagConstraints creditsConstraints = new GridBagConstraints();
		creditsConstraints.gridx = 0;
		creditsConstraints.gridy = 1;
		creditsConstraints.gridwidth = 3;
		
		GridBagConstraints mainConstraints = new GridBagConstraints();
		mainConstraints.gridx = 1;
		mainConstraints.gridwidth = 1;
		mainConstraints.weightx = 0.5;
		mainConstraints.weighty = 1.5;
		mainConstraints.anchor = GridBagConstraints.SOUTH;
		
		m_Header = new JLabel("Credits");
		m_Credits = new JTextArea("Written by David Wallin (c2007)\nUsing Java, php and mySQL\n\n\tThanx to Calle!\nFor hosting php-scripts and database\n\ndavid@pansarvagn.net\ncalle@pansarvagn.net");
		m_Main = new JButton("Main screen");
		
		Font f = new Font("Times", Font.BOLD, 14);
		m_Header.setFont(f);
		m_Header.setHorizontalAlignment(JLabel.CENTER);
		m_Header.setVerticalAlignment(JLabel.CENTER);
		m_Header.setBackground(Color.black);
		m_Header.setForeground(Color.gray);
		
		f = new Font("Times", Font.ITALIC, 12);
		m_Credits.setEditable(false);
		m_Credits.setBackground(Color.black);
		m_Credits.setForeground(Color.white);
		m_Credits.setFont(f);
		
		m_Main.addActionListener(this);
		
		this.addComponent(m_Header, gridBag, headerConstraints);
		this.addComponent(m_Credits, gridBag, creditsConstraints);
		this.addComponent(m_Main, gridBag, mainConstraints);
		
		this.doLayout();
	}
	
	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	public void actionPerformed(ActionEvent event)
	{
		Object source = event.getSource();
		
		if(source == m_Main)
		{
			this.updateFrameSwitchListeners(Frames.MAIN_MENU);
		}
	}
}
